//
//  SmsCloudPhoneView.m
//  smsCloud
//
//  Created by 吴斌 on 2024/7/20.
//

#import "SmsCloudPhoneView.h"
@interface SmsCloudPhoneView()
@property (nonatomic,strong) UIImageView *smsCloudImgView;
@property (nonatomic,strong) UILabel *smsCloudNameLab;
@end
@implementation SmsCloudPhoneView
-(instancetype)init{
    if (self == [super init]) {
        self.backgroundColor = [SmsCloudHead SmsCloudColorHexString:@"#E6F5FF"];
        [self smsCloudInitView];
    }
    return self;
}
- (void)smsCloudInitView{
    self.smsCloudImgView = [[UIImageView alloc] init];
    [self addSubview:self.smsCloudImgView];
    [self.smsCloudImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@([SmsCloudHead SmsCloudScreewRatio:61]));
        make.centerX.equalTo(self);
        make.width.equalTo(@([SmsCloudHead SmsCloudScreewRatio:160]));
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:160]));
    }];
    self.smsCloudNameLab = [[UILabel alloc] init];
    self.smsCloudNameLab.font = [UIFont systemFontOfSize:[SmsCloudHead SmsCloudScreewRatio:38] weight:UIFontWeightRegular];
    self.smsCloudNameLab.textColor = [SmsCloudHead SmsCloudColorHexString:@"#262729"];
    [self addSubview:self.smsCloudNameLab];
    [self.smsCloudNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self.smsCloudImgView.mas_bottom).offset([SmsCloudHead SmsCloudScreewRatio:24]);
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:53]));
    }];
}
-(void)setSmsCloudProductMdl:(SmsCloudProductModel *)smsCloudProductMdl{
    _smsCloudProductMdl = smsCloudProductMdl;
    if(_smsCloudProductMdl){
        self.smsCloudNameLab.text = _smsCloudProductMdl.name;
        [self.smsCloudImgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://www.ydl.cool/img/static/sms/%@0.webp",_smsCloudProductMdl.code]] placeholderImage:[SmsCloudHead SmsCloudImageNamed:@"smsCloudLogo"]];
    }
}
@end
